package com.shujia.connctionpoolcheck;

import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;

public class ConnectionPoolConfig {
    private String user;
    private String passwd;
    private String url;

    private String driver;

    private int initNum;
    private int maxNum;

    private int outTime;

    private int delayTime;

    private int periodTime;

    private boolean scheduler;


    public ConnectionPoolConfig() {
        Properties properties = new Properties();
        try {
            properties.load(new FileReader("redisCode/src/main/resources/connectionPool.properties"));
            user = properties.getProperty("user");
            passwd = properties.getProperty("passwd");
            url = properties.getProperty("url");
            driver = properties.getProperty("driver");
            initNum = Integer.parseInt(properties.getProperty("initNum"));
            maxNum = Integer.parseInt(properties.getProperty("maxNum"));
            outTime = Integer.parseInt(properties.getProperty("outTime"));
            delayTime = Integer.parseInt(properties.getProperty("delayTime"));
            periodTime = Integer.parseInt(properties.getProperty("periodTime"));
            scheduler = Boolean.parseBoolean(properties.getProperty("scheduler"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public boolean isScheduler() {
        return scheduler;
    }

    public void setScheduler(boolean scheduler) {
        this.scheduler = scheduler;
    }

    public int getPeriodTime() {
        return periodTime;
    }

    public void setPeriodTime(int periodTime) {
        this.periodTime = periodTime;
    }

    public int getDelayTime() {
        return delayTime;
    }

    public void setDelayTime(int delayTime) {
        this.delayTime = delayTime;
    }

    public int getOutTime() {
        return outTime;
    }

    public void setOutTime(int outTime) {
        this.outTime = outTime;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getPasswd() {
        return passwd;
    }

    public void setPasswd(String passwd) {
        this.passwd = passwd;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getDriver() {
        return driver;
    }

    public void setDriver(String driver) {
        this.driver = driver;
    }

    public int getInitNum() {
        return initNum;
    }

    public void setInitNum(int initNum) {
        this.initNum = initNum;
    }

    public int getMaxNum() {
        return maxNum;
    }

    public void setMaxNum(int maxNum) {
        this.maxNum = maxNum;
    }


}
